package tests.container

abstract class Monoid[T] {
  def speak:String
}

class NeedsImplicitMember[T](implicit val member:Monoid[T]){
  def speak = "My member says... "+member.speak
}

object ImplicitTests {
  
  implicit object StringMonoid extends Monoid[String]{
    override def speak = "I'm a String"
  } 
  
  implicit object IntMonoid extends Monoid[Int]{
    override def speak = "I'm an Int"
  } 
  
  def main(args : Array[String]) {
    val nim = new NeedsImplicitMember[Int]
    println(nim.speak)
  }
}
